﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TransCode.Entitys;
using TransCode.Player.ImagePage;

namespace TransCode.Player.TargetPage
{
    /// <summary>
    /// Interaction logic for TargetObjectControl.xaml
    /// </summary>
    public partial class TargetObjectControl : UserControl
    {
        public TargetObjectControl()
        {
            InitializeComponent();
        }

        public void Add(TargetObject item)
        {
            this.Dispatcher.BeginInvoke((Action)delegate()
            {
                ImageBoxItem ui = new ImageBoxItem();

                ui.TargetObject = item;
                //TargetObject to = item;

                //BitmapImage source = new BitmapImage();
                //source.BeginInit();
                //source.UriSource = new Uri(to.ImagePath + to.ImageName, UriKind.RelativeOrAbsolute);
                //source.EndInit();
                //ui.img.Source = source;

                layout.Children.Add(ui);
            });
        }

        public void Clear()
        {
            layout.Children.Clear();
        }
    }
}
